Monad Transformers for Backtracking Search
نویسنده
چکیده
This paper extends Escardó and Oliva’s selection monad to the selection monad transformer, a general monadic framework for expressing backtracking search algorithms in Haskell. The use of the closely related continuation monad transformer for similar purposes is also discussed, including an implementation of a DPLL-like SAT solver with no explicit recursion. Continuing a line of work exploring connections between selection functions and game theory, we use the selection monad transformer with the nondeterminism monad to obtain an intuitive notion of backward induction for a certain class of nondeterministic games.
منابع مشابه
Eilenberg-Moore Monoids and Backtracking Monad Transformers
We develop an algebraic underpinning of backtracking monad transformers in the general setting of monoidal categories. As our main technical device, we introduce Eilenberg–Moore monoids, which combine monoids with algebras for strong monads. We show that Eilenberg–Moore monoids coincide with algebras for the list monad transformer (‘done right’) known from Haskell libraries. From this, we obtai...
متن کاملBacktracking, Interleaving, and Terminating Monad Transformers
We design and implement a library for adding backtracking computations to any Haskell monad. Inspired by logic programming, our library provides, in addition to the operations required by the MonadPlus interface, constructs for fair disjunctions, fair conjunctions, conditionals, pruning, and an expressive top-level interface. Implementing these additional constructs is easy in models of backtra...
متن کاملDeriving Backtracking Monad Transformers Functional Pearl
In a paper about pretty printing J. Hughes introdu ed two fundamental te hniques for deriving programs from their spe i ation, where a spe i ation onsists of a signature and properties that the operations of the signature are required to satisfy. Brie y, the rst te hnique, the term implementation, represents the operations by terms and works by de ning a mapping from operations to observations ...
متن کاملPrological Features in a Functional Setting Axioms and Implementation
The purpose of this paper is twofold. First, we show that Prological features can be smoothly integrated into a functional language like Haskell. The resultingìanguage', embedded Prolog, lacks some concepts such as logical variables but it inherits all of Haskell's strengths eg static polymorphic typing, higher order functions etc. Technically, the integration is achieved using monads and monad...
متن کاملReinventing Haskell Backtracking
Almost ten years ago, Ralf Hinze has written a functional pearl on how to derive backtracking functionality for the purely functional programming language Haskell. In these notes, we show how to arrive at the efficient, two-continuation based backtracking monad derived by Hinze starting from an intuitive inefficient implementation that we subsequently refine using well known program transformat...
متن کامل